<div>
	<yu-panel title="作业警示管理">
		<yu-row :gutter="24">
			<yu-col :span="5">
				<yu-xtree ref="refTree" :height="height - 20" @node-click="nodeClickFn" :data-url="treeDataUrl" data-id="paramCode" data-label="paramName"
				 data-pid="parentId" :data-async="async" data-root="0000" style="margin:10px 10px 0 0;" icon="iconPath">
				</yu-xtree>
			</yu-col>
			<yu-col :span="19">
				<yu-xform related-table-name="refTable" form-type="search" v-model="searchFormdata">
					<yu-xform-group :column="4">
						<yu-xform-item label="系统名称" placeholder="系统名称" ctype="select" filterable name="appCode" @change="changeApp" :options="appOption"></yu-xform-item>
						<yu-xform-item label="所属作业流" placeholder="所属作业流" filterable ctype="select" name="groupCode"  @change="changeGroupCode" :options="groupOption"></yu-xform-item>
						<yu-xform-item label="所属作业" placeholder="所属作业" filterable ctype="select" name="actionCode" :options="actionOption"></yu-xform-item>
					</yu-xform-group>
				</yu-xform>
				<yu-toolBar>
					<yu-button @click="addFn" v-if="nodeLeaf&&addFnButton">新增</yu-button>
					<yu-button @click="modifyFn" v-if="updateFnButton">修改</yu-button>
					<yu-button @click="deleteFn" v-if="deleteFnButton">删除</yu-button>
					<yu-button @click="importExcelFn" v-if="importFnButton">excel导入</yu-button>
					<yu-button @click="exportExcelFn" v-if="exportFnButton">excel导出</yu-button>
				</yu-toolBar>
				<div ref="tableBox" style="overflow: auto;">
					<yu-xtable :height="tbHeight" ref="refTable" row-number :data-url="dataUrl" selection-type="checkbox">
						<yu-xtable-column label="系统名称" :show-overflow-tooltip="true" prop="appName"></yu-xtable-column>
						<yu-xtable-column label="警示条件名称" :show-overflow-tooltip="true" prop="ruleName">
							<template slot-scope="scope">
								<a class="diandian" style="text-decoration:underline;color:#636CE4 " href="javascipt:void(0);" @click="viewDataFn(scope.row)">{{ scope.row.ruleName }}</a>
							</template>
						</yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="所属作业流" prop="groupName"></yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="所属作业" prop="actionName"></yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="警示条件类型" prop="alarmClass" :options="alarmClassOptions"></yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="警示条件状态" prop="validFlag" data-code="USE_TASK_STATE"></yu-xtable-column>
						<yu-xtable-column :show-overflow-tooltip="true" label="备注" prop="remark"></yu-xtable-column>
					</yu-xtable>
				</div>
				<yu-xdialog :title="viewTitle" :visible.sync="dialogVisible" width="800px">
					<el-tabs type="border-card" v-model="activeTabName">
						<el-tab-pane label="基本信息" name="basicInfo" :disabled="true">
							<yu-collapse v-model="collActiveNames" accordion>
								<yu-collapse-item title="警示条件信息" name="collWarns">
									<el-form-x ref="refWarnsForm" :group-fields="warnsInfoFormFields" label-width="90px"></el-form-x>
									<el-form label-width="90px">
										<el-form-item label="例外时点:">
											<yu-toolBar>
												<el-button @click="addExceptCfg">新增</el-button>
												<el-button @click="deleteExceptCfg">删除</el-button>
											</yu-toolBar>
											<yu-xtable selection-type="checkbox" ref="refExceptTab" :pageable="false" :data="exceptDatas" style="width: 100%" row-number
											 max-height="150">
												<yu-xtable-column prop="timeType" style="width: 40%" :options="datatimeOptions" label="时间类型">
												</yu-xtable-column>
												<yu-xtable-column prop="exceptTime" label="例外时点" v-if="1>2">
												</yu-xtable-column>
												<yu-xtable-column prop="exceptTimeDesc" style="width: 50%" label="例外时点">
												</yu-xtable-column>
											</yu-xtable>
										</el-form-item>
									</el-form>
								</yu-collapse-item>
								<yu-collapse-item title="作业所属范围" name="collBasic">
									<el-form-x ref="refBasicForm" :group-fields="basicInfoFormFields" label-width="90px"></el-form-x>
								</yu-collapse-item>
								<yu-collapse-item title="作业警示条件" name="collCond">
									<yu-xform ref="refCondForm" v-model="condDataModel" label-width="130px">
										<yu-xform-group>
											<yu-xform-item label="事件系统" ctype="select" :options="eventAppOptions" @change="changeEventApp" name="eventApp" required v-if="classCode=='D'"></yu-xform-item>
											<yu-xform-item label="事件名称" ctype="select" :options="eventCodeOptions" name="eventCode" v-if="classCode=='D'"></yu-xform-item>
											<yu-xform-item label="延迟秒数" ctype="input" :rules="integerRules2" name="timeLimit" v-if="classCode=='D'"></yu-xform-item>
											<yu-xform-item label="低于平均时间(%)" ctype="input" :rules="integerRules2" name="minValueT" v-if="classCode=='T'"></yu-xform-item>
											<yu-xform-item label="高于平均时间(%)" ctype="input" :rules="integerRules2" name="maxValueT" v-if="classCode=='T'"></yu-xform-item>
											<yu-xform-item label="低于绝对时间" ctype="input" :rules="integerRules2" name="minValueL" v-if="classCode=='L'"></yu-xform-item>
											<yu-xform-item label="高于绝对时间" ctype="input" :rules="integerRules2" name="maxValueL" v-if="classCode=='L'"></yu-xform-item>
											<yu-xform-item label="返回值下限" ctype="input" :rules="integerRules" name="minValue" v-if="classCode=='R'"></yu-xform-item>
											<yu-xform-item label="返回值上限" ctype="input" :rules="integerRules" name="maxValue" v-if="classCode=='R'"></yu-xform-item>
										</yu-xform-group>
									</yu-xform>
								</yu-collapse-item>
							</yu-collapse>
							<el-form-x ref="endRefForm" :group-fields="remarkFields" :buttons="firstStepFormButtons" label-width="90px"></el-form-x>
						</el-tab-pane>
						<el-tab-pane label="对象配置" name="configInfo" :disabled="true">
							<yu-toolBar>
								<!-- <el-button @click="addObjCfg">新增</el-button> -->
								<!-- <el-button @click="userChoosefn">选择用户</el-button> -->
								<el-button @click="checkObjDataFn">已有对象</el-button>
								<!-- <el-button @click="checkGroupDataFn">对象组</el-button> -->
								<el-button @click="deleteObjCfg">删除</el-button>
							</yu-toolBar>
							<yu-xtable selection-type="checkbox" ref="refObjTab" :pageable="false" :data="objDatas" style="width: 100%" row-number max-height="350" @cell-mouse-enter="setDisabled">
								<yu-xtable-column prop="targetName" :disabled="disfalse" ctype="input" required rules="required" label="对象名称">
								</yu-xtable-column>
								<yu-xtable-column prop="alarmMode" ctype="select" :disabled="disfalse" :options="alarmModeDatas" @change="changeAlermMode" label="报警方式">
								</yu-xtable-column>
								<yu-xtable-column prop="targetData" ctype="input" label="对象地址" :disabled="disfalse">
								</yu-xtable-column>
								<yu-xtable-column prop="templateCode" ctype="select" :options="currTemplateDatas" :formatter="filterMethodFn" label="警示模版">
								</yu-xtable-column>
								<yu-xtable-column ctype="input" prop="remark" label="备注">
								</yu-xtable-column>
							</yu-xtable>
							<div class="yu-grpButton">
								<yu-button @click="lastStepFn">上一步</yu-button>
								<yu-button type="primary" v-if="!isView" @click="saveFn" :disabled="isView">保存</yu-button>
								<yu-button type="info" v-if="isView" @click="saveFn" :disabled="isView">保存</yu-button>
								<yu-button @click="cancelFn">关闭</yu-button>
							</div>
						</el-tab-pane>
					</el-tabs>
				</yu-xdialog>


				<yu-dialog title="excel导入" :visible.sync="upLoadDialogVisible" width="400px" v-loading="excelloading">
					<yu-upload class="upload-demo" ref="my-upload" :action="upLoadUrl" accept=".xls,.xlsx" :before-upload="checkUpload"
							   :multiple="multipleFalg"	:on-success="successUpload" :file-list="appUploadDatas">
						<yu-button size="small" type="primary">点击上传</yu-button>
						<a slot="tip" class="downloadcss" @click="exportDemo">模板下载</a>
						<div slot="tip" class="el-upload__tip">只能上传excel文件，且不超过100M</div>
					</yu-upload>
					<div class="uplaod-errinfo" v-if="errshow">
						<yu-tag type="danger">上传失败，错误信息如下：</yu-tag>
						<div class="uplaod-errlist">
							<yu-table :data="errdata" highlight-current-row style="width:100%" show-header>
								<yu-table-column type="index"  width="50">

								</yu-table-column>
								<yu-table-column prop="errMsg" label="错误信息">

								</yu-table-column>
							</yu-table>
						</div>
					</div>
				</yu-dialog>

			</yu-col>
		</yu-row>
	</yu-panel>


	<yu-xdialog title="例外时点配置" :visible.sync="exceptTimeDialogVisible" width="600px">
		<el-form-x ref="excetTimeForm" :group-fields="exceptTimeFields" :buttons="exceptTimeFormButtons" label-width="90px"></el-form-x>
	</yu-xdialog>

	<yu-xdialog title="已有对象选择" :visible.sync="objectTabVisible" width="800px">
		<el-form-q ref="queryObjRef" :field-data="queryObjFields" :buttons="queryObjButtons"></el-form-q>
		<yu-xtable ref="refObjUsedTable" row-number :data-url="objDataUrl" selection-type="checkbox">
			<yu-xtable-column label="对象名称" prop="targetName"></yu-xtable-column>
			<yu-xtable-column label="报警方式" prop="alarmMode" data-code="USE_ALERTM_MODE"></yu-xtable-column>
			<yu-xtable-column label="对象地址" prop="targetData"></yu-xtable-column>
			<yu-xtable-column label="备注" prop="remark"></yu-xtable-column>
		</yu-xtable>
	</yu-xdialog>

	<yu-xdialog title="已有对象组选择" :visible.sync="groupTabVisible" width="800px">
		<el-form-q ref="queryGroupRef" :field-data="queryGroupFields" :buttons="queryGroupButtons"></el-form-q>
		<yu-xtable ref="refGroupUsedTable" row-number :data-url="groupDataUrl" selection-type="checkbox">
			<yu-xtable-column label="对象组编号" prop="groupCode"></yu-xtable-column>
			<yu-xtable-column label="对象组名称" prop="groupName"></yu-xtable-column>
			<yu-xtable-column label="备注" prop="remark"></yu-xtable-column>
		</yu-xtable>
	</yu-xdialog>

	<yu-xdialog title="已有用户选择" :visible.sync="objectUserTabVisible" width="800px">
		<el-form-q ref="queryObjUserRef" :field-data="queryObjUserFields" :buttons="queryObjUserButtons"></el-form-q>
		<yu-xtable ref="refObjUserTable" row-number :data-url="objDataUserUrl" :base-params="baseParam" selection-type="checkbox">
			<yu-xtable-column label="登录代码" prop="loginCode"></yu-xtable-column>
			<yu-xtable-column label="员工号" prop="userCode"></yu-xtable-column>
			<yu-xtable-column label="用户名称" prop="userName"></yu-xtable-column>
			<yu-xtable-column label="所属部门" prop="dptName"></yu-xtable-column>
			<yu-xtable-column label="邮箱" prop="userEmail"></yu-xtable-column>
			<yu-xtable-column label="电话" prop="userMobilephone"></yu-xtable-column>
		</yu-xtable>
	</yu-xdialog>
</div>
<style type="text/css">
	.diandian{
		overflow: hidden;
		word-break: break-all;
		box-sizing: border-box;
		text-overflow: ellipsis;
	}
</style>